
import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

// 路由配置
const routes = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('@/views/register/index'),
    hidden: true
  },
  {
    path: '/',
    component: () => import('@/layout/index'),
    redirect: '/dashboard',
    children: [
      {
        path: 'dashboard',
        name: 'Dashboard',
        component: () => import('@/views/dashboard/index'),
        meta: { title: '首页', icon: 'dashboard' }
      }
    ]
  },
  {
    path: '/document',
    component: () => import('@/layout/index'),
    redirect: '/document/list',
    name: 'Document',
    meta: { title: '文档管理', icon: 'document' },
    children: [
      {
        path: 'list',
        name: 'DocumentList',
        component: () => import('@/views/document/index'),
        meta: { title: '我的文档', icon: 'list' }
      },
      {
        path: 'upload',
        name: 'DocumentUpload',
        component: () => import('@/views/document/upload'),
        meta: { title: '上传文档', icon: 'upload' }
      }
    ]
  },
  {
    path: '/video',
    component: () => import('@/layout/index'),
    redirect: '/video/list',
    name: 'Video',
    meta: { title: '视频管理', icon: 'video' },
    children: [
      {
        path: 'list',
        name: 'VideoList',
        component: () => import('@/views/video/index'),
        meta: { title: '我的视频', icon: 'list' }
      },
      {
        path: 'generate/:id',
        name: 'VideoGenerate',
        component: () => import('@/views/video/generate'),
        meta: { title: '生成视频', icon: 'generate' },
        hidden: true
      },
      {
        path: 'preview/:id',
        name: 'VideoPreview',
        component: () => import('@/views/video/preview'),
        meta: { title: '视频预览', icon: 'preview' },
        hidden: true
      }
    ]
  },
  {
    path: '/profile',
    component: () => import('@/layout/index'),
    redirect: '/profile/index',
    hidden: true,
    children: [
      {
        path: 'index',
        name: 'Profile',
        component: () => import('@/views/profile/index'),
        meta: { title: '个人中心', icon: 'user' }
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
